GtkCssParser *parser,
GFile *base)
{
- gboolean success;
+ GtkCssStyleProperty *style_property = GTK_CSS_STYLE_PROPERTY (property);
if (_gtk_css_parser_try (parser, "initial", TRUE))
{
}
g_value_init (value, _gtk_style_property_get_value_type (property));
- if (property->parse_func)
- success = (* property->parse_func) (parser, base, value);
- else
- success = _gtk_css_style_parse_value (value, parser, base);
-
- if (!success)
- g_value_unset (value);
+ if (!(* style_property->parse_value) (style_property, value, parser, base))
+ {
+ g_value_unset (value);
+ return FALSE;
+ }
- return success;
+ return TRUE;
}
static void
klass->style_properties = g_ptr_array_new ();
}
+static gboolean
+gtk_css_style_property_real_parse_value (GtkCssStyleProperty *property,
+ GValue *value,
+ GtkCssParser *parser,
+ GFile *base)
+{
+ return _gtk_css_style_parse_value (value, parser, base);
+}
+
+static void
+gtk_css_style_property_real_print_value (GtkCssStyleProperty *property,
+ const GValue *value,
+ GString *string)
+{
+ _gtk_css_style_print_value (value, string);
+}
+
static void
gtk_css_style_property_real_compute_value (GtkCssStyleProperty *property,
GValue *computed,
static void
_gtk_css_style_property_init (GtkCssStyleProperty *property)
{
+ property->parse_value = gtk_css_style_property_real_parse_value;
+ property->print_value = gtk_css_style_property_real_print_value;
property->compute_value = gtk_css_style_property_real_compute_value;
}
g_type_class_unref (enum_class);
}
- else if (GTK_STYLE_PROPERTY (property)->print_func)
- (* GTK_STYLE_PROPERTY (property)->print_func) (value, string);
else
- _gtk_css_style_print_value (value, string);
+ property->print_value (property, value, string);
}
/*** REGISTRATION ***/
static void
-_gtk_style_property_register (const char * name,
- GType value_type,
- GtkStylePropertyFlags flags,
- GtkStyleParseFunc parse_func,
- GtkStylePrintFunc print_func,
- const GValue * initial_value)
+_gtk_style_property_register (const char * name,
+ GType value_type,
+ GtkStylePropertyFlags flags,
+ GtkCssStylePropertyParseFunc parse_value,
+ GtkCssStylePropertyPrintFunc print_value,
+ const GValue * initial_value)
{
- GtkStyleProperty *node;
+ GtkCssStyleProperty *node;
node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY,
"inherit", (flags & GTK_STYLE_PROPERTY_INHERIT) ? TRUE : FALSE,
"name", name,
"value-type", value_type,
NULL);
- node->parse_func = parse_func;
- node->print_func = print_func;
+
+ if (parse_value)
+ node->parse_value = parse_value;
+ if (print_value)
+ node->print_value = print_value;
}
static void
-gtk_style_property_register (const char * name,
- GType value_type,
- GtkStylePropertyFlags flags,
- GtkStyleParseFunc parse_func,
- GtkStylePrintFunc print_func,
+gtk_style_property_register (const char * name,
+ GType value_type,
+ GtkStylePropertyFlags flags,
+ GtkCssStylePropertyParseFunc parse_value,
+ GtkCssStylePropertyPrintFunc print_value,
...)
{
GValue initial_value = G_VALUE_INIT;
char *error = NULL;
va_list args;
- va_start (args, print_func);
+ va_start (args, print_value);
G_VALUE_COLLECT_INIT (&initial_value, value_type,
args, 0, &error);
if (error)
va_end (args);
- _gtk_style_property_register (name, value_type, flags, parse_func, print_func, &initial_value);
+ _gtk_style_property_register (name, value_type, flags, parse_value, print_value, &initial_value);
g_value_unset (&initial_value);
}
/*** IMPLEMENTATIONS ***/
static gboolean
-font_family_parse (GtkCssParser *parser,
- GFile *base,
- GValue *value)
+font_family_parse (GtkCssStyleProperty *property,
+ GValue *value,
+ GtkCssParser *parser,
+ GFile *base)
{
GPtrArray *names;
char *name;
}
static void
-font_family_value_print (const GValue *value,
- GString *string)
+font_family_value_print (GtkCssStyleProperty *property,
+ const GValue *value,
+ GString *string)
{
const char **names = g_value_get_boxed (value);
}
static gboolean
-bindings_value_parse (GtkCssParser *parser,
- GFile *base,
- GValue *value)
+bindings_value_parse (GtkCssStyleProperty *property,
+ GValue *value,
+ GtkCssParser *parser,
+ GFile *base)
{
GPtrArray *array;
GtkBindingSet *binding_set;
}
static void
-bindings_value_print (const GValue *value,
- GString *string)
+bindings_value_print (GtkCssStyleProperty *property,
+ const GValue *value,
+ GString *string)
{
GPtrArray *array;
guint i;
}
static gboolean
-border_corner_radius_value_parse (GtkCssParser *parser,
- GFile *base,
- GValue *value)
+border_corner_radius_value_parse (GtkCssStyleProperty *property,
+ GValue *value,
+ GtkCssParser *parser,
+ GFile *base)
{
GtkCssBorderCornerRadius corner;
}
static void
-border_corner_radius_value_print (const GValue *value,
- GString *string)
+border_corner_radius_value_print (GtkCssStyleProperty *property,
+ const GValue *value,
+ GString *string)
{
GtkCssBorderCornerRadius *corner;